package com.headsen.v3;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheStats;
import com.google.common.collect.ImmutableMap;

import javax.annotation.CheckForNull;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;

/**
 * 缓存版本2：在版本1的基础上细化锁的粒度
 * <p>
 * unsafe cas仿照 concurrenthashMap
 *
 * @author zxs
 * @version 1.0
 * @date 2022/7/30 9:32
 */
public class MyCacheV3<K, V> implements Cache<K, V> {

    public MyCacheV3(int initSize, int maxSize, int expireTimeAfterRefresh, int expireTimeAfterAccess) {

    }

    @CheckForNull
    @Override
    public V getIfPresent(Object key) {
        return null;
    }

    @Override
    public V get(K key, Callable<? extends V> loader) throws ExecutionException {
        return null;
    }

    @Override
    public ImmutableMap<K, V> getAllPresent(Iterable<?> keys) {
        return null;
    }

    @Override
    public void put(K key, V value) {

    }

    @Override
    public void putAll(Map<? extends K, ? extends V> m) {

    }

    @Override
    public void invalidate(Object key) {

    }

    @Override
    public void invalidateAll(Iterable<?> keys) {

    }

    @Override
    public void invalidateAll() {

    }

    @Override
    public long size() {
        return 0;
    }

    @Override
    public CacheStats stats() {
        return null;
    }

    @Override
    public ConcurrentMap<K, V> asMap() {
        return null;
    }

    @Override
    public void cleanUp() {

    }
}
